<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Login</title>
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
</head>
<body>

<form action="/login" method="post">
    <p>账号：<input type="text" id="username" name="username" value="admin"/></p>
    <p>密码：<input type="text" id="password" name="password" value="123456"/></p>
    <p><input id="login" type="button" value="登录"/></p>
</form>
</body>
</html>

<script>

    $("#login").click(function(){

        var username = $("#username").val();
        var password = $("#password").val();

        $.ajax({
            url: "http://api.wangbin.com/login",
            type: "POST",
            data: {username:username,password:password},
            dataType: "json",
            success: function (result) {
                console.log(result)
            },
            error: function (msg) {

            }
        })

    })



</script>